import React from 'react'
import { Toast } from '_antd-mobile@2.3.4@antd-mobile'
import { reqCartadd } from '../../../request/api'

export default function GoodsFooter(props) {
    let addCate = () => {
        reqCartadd(props.id).then(res => {
            if (res.code === 200) {
                Toast.info(res.msg)
            }
        })
    }
    let toShop = ()=>{
        props.history.push("/index/shop")
    }
    return (
        <div>
            <div className="footer">
                <div className="foo_img" onClick={()=>toShop()}>
                    <div className="space">
                        <span>2</span>
                    </div>
                    购物车
                </div>
                <div className="car01" onClick={() => addCate()}>加入购物车</div>
                <div className="car02">立即购买</div>
            </div>
        </div>
    )
}
